package com.ben.xinyue.seckill.access;

import com.ben.xinyue.seckill.domain.entity.MiaoshaUser;

/**
 * @author: xinyue
 * @date: 2020/9/15 10:21
 * @description: 上下文
 * @modifiedBy:
 * @version: 1.0
 */
public class UserContext {

    private static ThreadLocal<MiaoshaUser> userHolder = new ThreadLocal<MiaoshaUser>();
    public static void setUser(MiaoshaUser miaoshaUser) {
        userHolder.set(miaoshaUser);
    }
    public static MiaoshaUser getUser(){
        return userHolder.get();
    }
}
